using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class DiagnosticServiceSectionIDAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public DiagnosticServiceSectionIDAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v231] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v27] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"AU","BG","BLB","CH","CP","CT","CTH","CUS","EC","EN","HM","ICU","IMM","LAB","MB","MCB","MYC","NMR","NMS","NRS","OSL","OT","OTH","OUS","PF","PHR","PHY","PT","RAD","RC","RT","RUS","RX","SP","SR","TX","VR","VUS","XRC"};
						validVersionCodes[HL7Version.v231] = new string[]{"AU","BG","BLB","CUS","CTH","CT","CH","CP","EC","EN","HM","ICU","IMM","LAB","MB","MCB","MYC","NMS","NMR","NRS","OUS","OT","OTH","OSL","PHR","PT","PHY","PF","RAD","RX","RUS","RC","RT","SR","SP","TX","VUS","VR","XRC"};
						validVersionCodes[HL7Version.v24] = new string[]{"AU","BG","BLB","CUS","CTH","CT","CH","CP","EC","EN","HM","ICU","IMG","IMM","LAB","MB","MCB","MYC","NMS","NMR","NRS","OUS","OT","OTH","OSL","PHR","PAR","PAT","PT","PHY","PF","RAD","RX","RUS","RC","RT","SR","SP","TX","URN","VUS","VR","XRC"};
						validVersionCodes[HL7Version.v25] = new string[]{"AU","BG","BLB","CUS","CTH","CT","CH","CP","EC","EN","HM","ICU","IMM","LAB","MB","MCB","MYC","NMS","NMR","NRS","OUS","OT","OTH","OSL","PHR","PT","PHY","PF","RAD","RX","RUS","RC","RT","SR","SP","TX","VUS","VR","XRC"};
						validVersionCodes[HL7Version.v251] = new string[]{"AU","BG","BLB","CUS","CTH","CT","CH","CP","EC","EN","HM","ICU","IMM","LAB","MB","MCB","MYC","NMS","NMR","NRS","OUS","OT","OTH","OSL","PHR","PT","PHY","PF","RAD","RX","RUS","RC","RT","SR","SP","TX","VUS","VR","XRC"};
						validVersionCodes[HL7Version.v26] = new string[]{"AU","BG","BLB","CUS","CTH","CT","CH","CP","EC","EN","HM","ICU","IMM","LAB","MB","MCB","MYC","NMS","NMR","NRS","OUS","OT","OTH","OSL","PHR","PT","PHY","PF","RAD","RX","RUS","RC","RT","SR","SP","TX","VUS","VR","XRC"};
						validVersionCodes[HL7Version.v27] = new string[]{"AU","BG","BLB","CUS","CTH","CT","CH","CP","EC","EN","HM","ICU","IMM","LAB","MB","MCB","MYC","NMS","NMR","NRS","OUS","OT","OTH","OSL","PHR","PT","PHY","PF","RAD","RX","RUS","RC","RT","SR","SP","TX","VUS","VR","XRC"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Audiology","Blood gases","Blood bank","Chemistry","Cytopathology","CAT scan","Cardiac catheterization","Cardiac Ultrasound","Electrocardiac (e.g., EKG,  EEC, Holter)","Electroneuro (EEG, EMG,EP,PSG)","Hematology","Bedside ICU Monitoring","Immunology","Laboratory","Microbiology","Mycobacteriology","Mycology","Nuclear magnetic resonance","Nuclear medicine scan","Nursing service measures","Outside Lab","Occupational Therapy","Other","OB Ultrasound","Pulmonary function","Pharmacy","Physician (Hx. Dx, admission note, etc.l)","Physical Therapy","Radiology","Respiratory Care (therapy)","Radiation therapy","Radiology ultrasound","Radiograph","Surgidal Pathology","Serology","Toxicology","Virology","Vascular Ultrasound","Cineradiograph"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Audiology","Blood Gases","Blood Bank","Cardiac Ultrasound","Cardiac Catheterization","CAT Scan","Chemistry","Cytopathology","Electrocardiac (e.g., EKG,  EEC, Holter)","Electroneuro (EEG, EMG,EP,PSG)","Hematology","Bedside ICU Monitoring","Immunology","Laboratory","Microbiology","Mycobacteriology","Mycology","Nuclear Medicine Scan","Nuclear Magnetic Resonance","Nursing Service Measures","OB Ultrasound","Occupational Therapy","Other","Outside Lab","Pharmacy","Physical Therapy","Physician (Hx. Dx, admission note, etc.l)","Pulmonary Function","Radiology","Radiograph","Radiology Ultrasound","Respiratory Care (therapy)","Radiation Therapy","Serology","Surgical Pathology","Toxicology","Vascular Ultrasound","Virology","Cineradiograph"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Audiology","Blood Gases","Blood Bank","Cardiac Ultrasound","Cardiac Catheterization","CAT Scan","Chemistry","Cytopathology","Electrocardiac (e.g., EKG,  EEC, Holter)","Electroneuro (EEG, EMG,EP,PSG)","Hematology","Bedside ICU Monitoring","Diagnostic Imaging","Immunology","Laboratory","Microbiology","Mycobacteriology","Mycology","Nuclear Medicine Scan","Nuclear Magnetic Resonance","Nursing Service Measures","OB Ultrasound","Occupational Therapy","Other","Outside Lab","Pharmacy","Parasitology","Pathology (gross & histopath, not surgical)","Physical Therapy","Physician (Hx. Dx, admission note, etc.)","Pulmonary function","Radiology","Radiograph","Radiology ultrasound","Respiratory Care (therapy)","Radiation therapy","Serology","Surgical Pathology","Toxicology","Urinalysis","Vascular Ultrasound","Virology","Cineradiograph"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Audiology","Blood Gases","Blood Bank","Cardiac Ultrasound","Cardiac Catheterization","CAT Scan","Chemistry","Cytopathology","Electrocardiac (e.g., EKG,  EEC, Holter)","Electroneuro (EEG, EMG,EP,PSG)","Hematology","Bedside ICU Monitoring","Immunology","Laboratory","Microbiology","Mycobacteriology","Mycology","Nuclear Medicine Scan","Nuclear Magnetic Resonance","Nursing Service Measures","OB Ultrasound","Occupational Therapy","Other","Outside Lab","Pharmacy","Physical Therapy","Physician (Hx. Dx, admission note, etc.)","Pulmonary Function","Radiology","Radiograph","Radiology Ultrasound","Respiratory Care (therapy)","Radiation Therapy","Serology","Surgical Pathology","Toxicology","Vascular Ultrasound","Virology","Cineradiograph"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Audiology","Blood Gases","Blood Bank","Cardiac Ultrasound","Cardiac Catheterization","CAT Scan","Chemistry","Cytopathology","Electrocardiac (e.g., EKG,  EEC, Holter)","Electroneuro (EEG, EMG,EP,PSG)","Hematology","Bedside ICU Monitoring","Immunology","Laboratory","Microbiology","Mycobacteriology","Mycology","Nuclear Medicine Scan","Nuclear Magnetic Resonance","Nursing Service Measures","OB Ultrasound","Occupational Therapy","Other","Outside Lab","Pharmacy","Physical Therapy","Physician (Hx. Dx, admission note, etc.)","Pulmonary Function","Radiology","Radiograph","Radiology Ultrasound","Respiratory Care (therapy)","Radiation Therapy","Serology","Surgical Pathology","Toxicology","Vascular Ultrasound","Virology","Cineradiograph"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Audiology","Blood Gases","Blood Bank","Cardiac Ultrasound","Cardiac Catheterization","CAT Scan","Chemistry","Cytopathology","Electrocardiac (e.g., EKG,  EEC, Holter)","Electroneuro (EEG, EMG,EP,PSG)","Hematology","Bedside ICU Monitoring","Immunology","Laboratory","Microbiology","Mycobacteriology","Mycology","Nuclear Medicine Scan","Nuclear Magnetic Resonance","Nursing Service Measures","OB Ultrasound","Occupational Therapy","Other","Outside Lab","Pharmacy","Physical Therapy","Physician (Hx. Dx, admission note, etc.)","Pulmonary Function","Radiology","Radiograph","Radiology Ultrasound","Respiratory Care (therapy)","Radiation Therapy","Serology","Surgical Pathology","Toxicology","Vascular Ultrasound","Virology","Cineradiograph"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Audiology","Blood Gases","Blood Bank","Cardiac Ultrasound","Cardiac Catheterization","CAT Scan","Chemistry","Cytopathology","Electrocardiac (e.g., EKG,  EEC, Holter)","Electroneuro (EEG, EMG,EP,PSG)","Hematology","Bedside ICU Monitoring","Immunology","Laboratory","Microbiology","Mycobacteriology","Mycology","Nuclear Medicine Scan","Nuclear Magnetic Resonance","Nursing Service Measures","OB Ultrasound","Occupational Therapy","Other","Outside Lab","Pharmacy","Physical Therapy","Physician (Hx. Dx, admission note, etc.)","Pulmonary Function","Radiology","Radiograph","Radiology Ultrasound","Respiratory Care (therapy)","Radiation Therapy","Serology","Surgical Pathology","Toxicology","Vascular Ultrasound","Virology","Cineradiograph"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
